-module(test).
-export([test/0]).

-record(person,{name="",age,phone}).

foobar(P) when P#person.name=="Joe" ->
    io:format("Name: ~p~n", [P#person.name]).

%foobar2(P) when is_record(P, person),P#person.name=="Joe"->
foobar2(#person{name=Name}) ->
    io:format("Name: ~p~n", [Name]).

test() ->
    Person1 = "joe",
    Person2 = #person{name="Joe", age=21, phone="999-999"},
    %foobar2(Person1),
    foobar(Person2),
    foobar2(Person2),
    foobar2(Person1),
    foobar(Person1).
    %foobar(Person1),
    %foobar(Person2).
    
